const express = require('express')
const router = express.Router()

const { toggleCollection, isCollected, getUserCollectedData } = require('../../controller/web/CollectionController')

// 导入JWT拦截中间件
const checkTokenMiddleware = require('../../middleware/checkTokenMiddleware')

// 添加/取消收藏
router.post('/collection', checkTokenMiddleware, toggleCollection)

// 收藏状态查询
router.get('/collection/is_collected', checkTokenMiddleware, isCollected)

// 获取用户收藏的商品数据
router.get('/collection/user/:user_id', checkTokenMiddleware, getUserCollectedData)

module.exports = router